﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SuffixTreeView.ViewModel;

namespace SuffixTreeView
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public static RoutedCommand CreateNewTree = new RoutedCommand(
            "CreateNewTree",
            typeof(MainWindow),
            new InputGestureCollection { new KeyGesture(Key.N, ModifierKeys.Control, "Ctrl+N") });

        GraphViewModel _viewModel;
        public MainWindow()
        {
            _viewModel = new GraphViewModel();
            this.DataContext = _viewModel;
            InitializeComponent();
        }

        private void CreateNewTree_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = !string.IsNullOrWhiteSpace(_viewModel.Text);
        }

        private void CreateNewTree_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            _viewModel.CreateNewTreeView();
        }
    }
}
